<div id="bg-search">                
    <div id="search">
        <ul class="search-text">
            <li>Search Country: </li>
            <li><a href="javascript:void(0)" class="countrycode">A</a></li>
            <li><a href="javascript:void(0)" class="countrycode">B</a></li>
            <li><a href="javascript:void(0)" class="countrycode">C</a></li>
            <li><a href="javascript:void(0)" class="countrycode">D</a></li>
            <li><a href="javascript:void(0)" class="countrycode">E</a></li>
            <li><a href="javascript:void(0)" class="countrycode">F</a></li>
            <li><a href="javascript:void(0)" class="countrycode">G</a></li>
            <li><a href="javascript:void(0)" class="countrycode">H</a></li>
            <li><a href="javascript:void(0)" class="countrycode">I</a></li>
            <li><a href="javascript:void(0)" class="countrycode">K</a></li>
            <li><a href="javascript:void(0)" class="countrycode">L</a></li>
            <li><a href="javascript:void(0)" class="countrycode">M</a></li>
            <li><a href="javascript:void(0)" class="countrycode">N</a></li>
            <li><a href="javascript:void(0)" class="countrycode">O</a></li>
            <li><a href="javascript:void(0)" class="countrycode">P</a></li>
            <li><a href="javascript:void(0)" class="countrycode">R</a></li>
            <li><a href="javascript:void(0)" class="countrycode">S</a></li>
            <li><a href="javascript:void(0)" class="countrycode">T</a></li>
            <li><a href="javascript:void(0)" class="countrycode">U</a></li>
            <li><a href="javascript:void(0)" class="countrycode">V</a></li>
            <li><a href="javascript:void(0)" class="countrycode">W</a></li>
            <li><a href="<?php echo $this->baseUrl('/search?c=mc');?>" class="countrycode">Monaco</a></li>
        </ul>
        <div class="clearfix"></div>
        <ul class="list-country">
            <li class="first">
                <ul class="child">
        <?php 
        $countryModel = new Application_Model_Country();
        $listCountry = $countryModel->getCountries();
        $i=0;
        foreach ($listCountry as $country):?>
            <?php if($i%7==0 && $i!=0):?>
                </ul>
            </li>
            <li class="first">
                <ul class="child">
            <?php endif;?>
                    <li><h6><a href="<?php echo $this->baseUrl('/search?c=' . strtolower($country['code']))?>"><?php echo $country['name']?></a></h6></li>
        <?php 
            $i++;
        endforeach;?>
        </ul>
    </div>
</div>
<script>
$(document).ready(function(){
    $('.countrycode').click(function(){
        var baseUrl = '<?php echo $this->baseUrl();?>';
        var sort = ($(this).html());
        $.ajax({
            'url': baseUrl + '/country/get-country-with-sort',
            'data': {'sort': sort},
            'type': 'POST',
            'success': function(response){
                $('.list-country').html(response);
            } 
        });
    });
});
</script>